The electorate did not legally elect President Trump. The legal means of electing the President lies in the electoral college. Those electors are the ones who actually elected the President. And since there is no accusations that those electors were illegally coerced into voting for President Trump, his election is valid no matter what a court might find.
There is some dispute in whether the President can be indicted while still in office. Some say that because he is the chief law enforcement officer he cannot be indicted while in office. Others say that his office cannot bar him from being indicted for a crime prior to him taking the oath. And even if he is convicted it raises the question would a conviction immediately remove him from office, since the constitution only gives two ways to remove a sitting president from office legally either by impeachment and removal or by the 25th where the cabinet and the VP deems that he cannot fulfill his duties and even with that the president has the right to dispute that fact with Congress.